package com.yvan.zipkin;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

public class Span implements Serializable {
    private String id;
    private String parentId;
    private String traceId;
    private String name;
    //private String serviceName;
    private List<Annotation> annotations;
    private List<BinaryAnnotation> binaryAnnotations;

    public Span() {
        this.annotations = new LinkedList<Annotation>();
        this.binaryAnnotations = new LinkedList<BinaryAnnotation>();
    }

    public void addAnnotation(Annotation annotation) {
        annotations.add(annotation);
    }

    public void addAnnotation(BinaryAnnotation binaryAnnotation) {
        binaryAnnotations.add(binaryAnnotation);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getTraceId() {
        return traceId;
    }

    public void setTraceId(String traceId) {
        this.traceId = traceId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Annotation> getAnnotations() {
        return annotations;
    }

    public void setAnnotations(List<Annotation> annotations) {
        this.annotations = annotations;
    }

    public List<BinaryAnnotation> getBinaryAnnotations() {
        return binaryAnnotations;
    }

    public void setBinaryAnnotations(List<BinaryAnnotation> binaryAnnotations) {
        this.binaryAnnotations = binaryAnnotations;
    }

    @Override
    public String toString() {
        return "Span{" +
                "id='" + id + '\'' +
                ", parentId='" + parentId + '\'' +
                ", traceId='" + traceId + '\'' +
                ", name='" + name + '\'' +
                ", annotations=" + annotations +
                ", binaryAnnotations=" + binaryAnnotations +
                '}';
    }
}